<style lang="scss" scoped>
.operate-exam-container ::v-deep {
    .el-breadcrumb__item:last-child ::v-deep {
        .el-breadcrumb__inner {
            color: #606266;
            font-weight: bold;
            cursor: default;
        }
    }
    .el-breadcrumb__item ::v-deep {
        .is-link {
            color: #aaa;
            font-weight: unset;
        }
        .is-link:hover {
            color: #409eff;
        }
    }
    .exam-form {
        padding-right: 10px;
    }
    .exam-form ::v-deep {
        .el-date-editor.el-input {
            width: 100% !important;
        }
        .editor-custom-btn-container {
            display: none;
        }
        .tinymce-container {
            margin: 0 !important;
        }
    }
    .title {
        font-size: 18px;
    }
    .el-divider--horizontal {
        margin: 10px 0 20px 0 !important;
    }
    .operate-btn-container {
        border-top: 1px solid #ebeef5;
        padding: 20px;
        margin-bottom: 30px;
    }
}
</style>
<template>
    <div class="operate-exam-container">
        <div style="height: 30px;">
            <el-breadcrumb style="float: left;" separator="/">
                <el-breadcrumb-item :to="{ path: '/interdiSciplinaryManagement' }">
                    <span
                        @click="reback()"
                    >{{ $t('interdisciplinaryManagement.interdisciplinaryManagement') }}</span>
                </el-breadcrumb-item>
                <el-breadcrumb-item>{{ variableList }}</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <el-card
            style="padding: 0!important;"
            shadow="never"
            v-loading="loading"
            body-style="padding: 24px;"
        >
            <el-row type="flex" class="row-bg" justify="space-between">
                <h2
                    style="color:#101010"
                >{{$t('interdisciplinaryManagement.interdisciplinaryManagement')}}</h2>
                <el-button @click="reback">{{$t('requirement.back')}}</el-button>
            </el-row>
            <hr style="border-top: 2px solid #eee;" />
            <h2
                style="margin-left:20px;color:#101010"
            >{{$t('interdisciplinaryManagement.personal')}}</h2>
            <el-form
                :model="queryForm"
                label-width="170px"
                :rules="rulesForm"
                ref="addform"
                label-suffix="："
            >
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.jobNumber')"
                            prop="teacherId"
                        >
                            <el-select
                                v-model="queryForm.teacherId"
                                filterable
                                remote
                                clearable
                                reserve-keyword
                                @change="changeClick"
                                :remote-method="remoteMethodOne"
                                style="width:100%"
                                v-clearreadonly
                            >
                                <el-option
                                    v-for="item in options.approver"
                                    :key="item.code"
                                    :label="item.code"
                                    :value="item.code"
                                >
                                    <!-- <span style="float: left">{{ item.name }}</span>
                                <span
                                    style="float: right; color: #8492a6; font-size: 13px"
                                    >{{ item.code }}</span>-->
                                </el-option>
                            </el-select>
                            <!-- <el-autocomplete style="width:100%"
                      class="inline-input"
                      v-model="queryForm.student"
                      :remote-method="remoteMethodOne"
                      :placeholder="$t('interdisciplinaryManagement.pleaseEnter')"
                      :trigger-on-focus="false"
                      
                            ></el-autocomplete>-->
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item :label="$t('interdisciplinaryManagement.name')">
                            <el-input v-model="queryForm.name" disabled width="100%"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item :label="$t('interdisciplinaryManagement.college')">
                            <el-input v-model="queryForm.college" disabled></el-input>
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item :label="$t('interdisciplinaryManagement.technical')">
                            <el-input v-model="queryForm.technical" disabled></el-input>
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.phoneNumber')"
                            prop="teacherPhone"
                        >
                            <el-input v-model.trim="queryForm.teacherPhone" maxlength="11"></el-input>
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.mailAddress')"
                            prop="teacherEmail"
                        >
                            <el-input v-model="queryForm.teacherEmail" maxlength="64"></el-input>
                            <!-- <CalendarSelect :defaulted='false' v-model="queryForm.calendarYear" @change="changeSelect" @load-done="loadDone"></CalendarSelect> -->
                        </el-form-item>
                    </el-col>
                </el-row>
                <h2
                    style="margin-left:20px;color:#101010"
                >{{$t('interdisciplinaryManagement.information')}}</h2>
                <edu-table
                    :pagination="false"
                    :order="false"
                    :selection="false"
                    :tooltipEffect="tooltipEffect"
                    stripe
                    :data="queryForm.studentList"
                    size="mini"
                    @selection-change="handleSelectionChange"
                >
                    <edu-table-column
                        :label="$t('interdisciplinaryManagement.studentNumber')"
                        prop="studentId"
                    >
                        <template slot-scope="scope">
                            <el-form-item
                                style="margin-top: 15px;"
                                :prop="'studentList.' + scope.$index + '.studentId'"
                                label-width="0"
                                :rules="rulesForm.studentId"
                            >
                                <!-- <el-input @change="changeInput" v-model.trim="scope.row.studentId" clearable></el-input> -->
                                <!-- <el-autocomplete
                        class="inline-input"
                        v-model="scope.row.studentId"
                        :fetch-suggestions="querySearch"
                        placeholder="请输入内容"
                        :trigger-on-focus="false"
                        @input="changeInput"
                                ></el-autocomplete>-->
                                <el-select
                                    v-model="scope.row.studentId"
                                    filterable
                                    remote
                                    reserve-keyword
                                    @change="changeInput"
                                    :remote-method="remoteMethodTow"
                                    style="width:100%"
                                    v-clearreadonly
                                >
                                    <el-option
                                        v-for="item in options.studentList"
                                        :key="item.studentId"
                                        :label="item.studentId"
                                        :value="item.studentId"
                                    ></el-option>
                                </el-select>
                            </el-form-item>
                        </template>
                    </edu-table-column>
                    <edu-table-column prop="studentName">
                        <template slot-scope="scope">
                            <div>{{ scope.row.studentName }}</div>
                            <div>{{ scope.row.studentFaculty }}</div>
                            <div>{{ scope.row.profession }}</div>
                        </template>
                    </edu-table-column>
                    <edu-table-column
                        :label="$t('interdisciplinaryManagement.trainClasses')"
                        prop="trainingCategory"
                    ></edu-table-column>
                    <edu-table-column
                        :label="$t('interdisciplinaryManagement.trainLevels')"
                        prop="trainingLevelName"
                    ></edu-table-column>
                    <edu-table-column
                        :label="$t('interdisciplinaryManagement.degreeType')"
                        prop="degreeType"
                    ></edu-table-column>
                    <edu-table-column
                        :label="$t('interdisciplinaryManagement.formsLearn')"
                        prop="formLearning"
                    >
                        <!-- <template slot-scope="scope">
                    <div>{{ scope.row.weight }}</div>
                        </template>-->
                    </edu-table-column>
                    <edu-table-column
                        :label="$t('interdisciplinaryManagement.failGrade')"
                        prop="isFlunk"
                    ></edu-table-column>
                    <edu-table-column
                        :label="$t('interdisciplinaryManagement.dissertation')"
                        prop="isSelected"
                    ></edu-table-column>
                    <edu-table-column
                        :label="$t('interdisciplinaryManagement.phoneNumber')"
                        prop="phoneNumber"
                    >
                        <template slot-scope="scope">
                            <el-form-item
                                style="margin-top: 15px;"
                                :prop="'studentList.' + scope.$index + '.phoneNumber'"
                                label-width="0"
                                :rules="rulesForm.phoneNumber"
                            >
                                <el-input
                                    v-model.trim="scope.row.phoneNumber"
                                    clearable
                                    maxlength="11"
                                ></el-input>
                            </el-form-item>
                        </template>
                    </edu-table-column>
                    <edu-table-column
                        :label="$t('interdisciplinaryManagement.mailbox')"
                        prop="email"
                    >
                        <template slot-scope="scope">
                            <el-form-item
                                style="margin-top: 15px;"
                                :prop="'studentList.' + scope.$index + '.email'"
                                label-width="0"
                                :rules="rulesForm.email"
                            >
                                <el-input v-model.trim="scope.row.email" clearable maxlength="64"></el-input>
                            </el-form-item>
                        </template>
                    </edu-table-column>
                </edu-table>
                <h2
                    style="margin-left:20px;color:#101010"
                >{{$t('interdisciplinaryManagement.applicaProject')}}</h2>
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.studentPaper')"
                            prop="paperTitle"
                        >
                            <el-input v-model="queryForm.paperTitle" disabled width="100%"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.interdisciplinary')"
                            prop="disciplineDomain"
                        >
                            <el-input
                                v-model="queryForm.disciplineDomain"
                                width="100%"
                                maxlength="64"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.nameSchool')"
                            prop="applySchoolId"
                        >
                            <el-select
                                @change="changeEnglisNameSchool"
                                v-model="queryForm.applySchoolId"
                                filterable
                                clearable
                                reserve-keyword
                                style="width:100%"
                                placeholder="请输入关键词"
                                :remote-method="remoteMethod"
                                :loading="loading"
                                v-clearreadonly
                            >
                                <el-option
                                    v-for="item in options.nameSchool"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                ></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.englisNameSchool')"
                            prop="applySchoolId"
                        >
                            <el-select
                                @change="changeEnglisNameSchool"
                                v-model="queryForm.applySchoolId"
                                filterable
                                clearable
                                reserve-keyword
                                style="width:100%"
                                placeholder="请输入关键词"
                                :remote-method="remoteMethod"
                                :loading="loading"
                                v-clearreadonly
                            >
                                <el-option
                                    v-for="item in options.englisNameSchool"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                ></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.country')"
                            prop="country"
                        >
                            <el-input v-model="queryForm.country" disabled width="100%"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.appliedDirection')"
                            prop="applyDirection"
                        >
                            <el-input
                                v-model="queryForm.applyDirection"
                                maxlength="64"
                                width="100%"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.applyMajor')"
                            prop="applyMajor"
                        >
                            <el-input v-model="queryForm.applyMajor" maxlength="64" width="100%"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.appliesStartExchange')"
                            prop="tutorStartTime"
                        >
                            <el-date-picker
                                style="width:100%"
                                v-model="queryForm.tutorStartTime"
                                type="date"
                                :picker-options="pickerOptionsStart"
                                value-format="yyyy-MM-dd"
                                format="yyyy-MM-dd"
                            ></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.appliesEndExchange')"
                            prop="tutorEndTime"
                        >
                            <el-date-picker
                                style="width:100%"
                                v-model="queryForm.tutorEndTime"
                                type="date"
                                :picker-options="pickerOptionsEnd"
                                value-format="yyyy-MM-dd"
                                format="yyyy-MM-dd"
                            >
                                <!-- :picker-options="pickerOptionsEnd" -->
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.studentsStartExchange')"
                            prop="studentStartTime"
                        >
                            <el-date-picker
                                style="width:100%"
                                v-model="queryForm.studentStartTime"
                                type="date"
                                :picker-options="pickerStudentStart"
                                value-format="yyyy-MM-dd"
                                format="yyyy-MM-dd"
                            ></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.studentsEndExchange')"
                            prop="studentEndTime"
                        >
                            <el-date-picker
                                style="width:100%"
                                v-model="queryForm.studentEndTime"
                                type="date"
                                :picker-options="pickerStudentEndTime"
                                value-format="yyyy-MM-dd"
                                format="yyyy-MM-dd"
                            ></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.applicaAmount')"
                            prop="applyMoney"
                        >
                            <el-input v-model="queryForm.applyMoney" maxlength="7" width="100%"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <h2
                    style="margin-left:20px;color:#101010"
                >{{$t('interdisciplinaryManagement.foreignTeacher')}}</h2>
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.nameForeign')"
                            prop="outsideTutorName"
                        >
                            <el-input
                                v-model="queryForm.outsideTutorName"
                                maxlength="64"
                                width="100%"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.mentorDiscipline')"
                            prop="outsideTutorSubject"
                        >
                            <el-input
                                v-model="queryForm.outsideTutorSubject"
                                maxlength="64"
                                width="100%"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.supervisor')"
                            prop="outsideTutorDirection"
                        >
                            <el-input
                                v-model="queryForm.outsideTutorDirection"
                                maxlength="64"
                                width="100%"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.professional')"
                            prop="outsideTutorJob"
                        >
                            <el-input
                                v-model="queryForm.outsideTutorJob"
                                maxlength="64"
                                width="100%"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.dutuies')"
                            prop="outsideTutorPost"
                        >
                            <el-input
                                v-model="queryForm.outsideTutorPost"
                                maxlength="64"
                                width="100%"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.academicParticip')"
                            prop="outsideTutorOfficeholding"
                        >
                            <el-input
                                v-model="queryForm.outsideTutorOfficeholding"
                                maxlength="64"
                                width="100%"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            :label="$t('interdisciplinaryManagement.tutorEmail')"
                            prop="outsideTeacherEmail"
                        >
                            <el-input
                                v-model="queryForm.outsideTeacherEmail"
                                maxlength="64"
                                width="100%"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row type="flex" class="row-bg" justify="end">
                    <el-button @click="reback">{{$t('requirement.cancel')}}</el-button>
                    <el-button type="danger" @click="conserve">{{$t('requirement.save')}}</el-button>
                    <!-- <el-button type="danger"  @click="affirmForm" >{{$t('requirement.submit')}}</el-button> -->
                </el-row>
            </el-form>
        </el-card>
    </div>
</template>
<script>
import { queryDic } from 'common/src/api/dictionary'
import UTILS from 'common/src/utils/utils'
import interAcaConferenceApi from 'common/src/api/internationalCommunication/interAcaConference'
import interManagementApi from 'common/src/api/externalExchange/interdiSciplinaryManagement'
import { findTeacherInfoList } from 'common/src/api/studentinfo'
export default {
    props: {
        compile: {
            type: String,
            default: ''
        },
        dataList: {
            type: Object,
            default: () => {}
        }
    },
    data() {
        let validateNum = (rule, value, callback) => {
            let reg = /^[1][3,4,5,7,8][0-9]{9}$/
            if (!reg.test(value) || value === '') {
                return callback(new Error(this.$t('interdisciplinaryManagement.pleasePhone')))
            }
            return callback()
        }
        // let validateNumEmail = (rule, value, callback) => {
        //   let reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
        //   if (!reg.test(value) || value === '') {
        //     return callback(new Error(this.$t('interdisciplinaryManagement.pleaseEnter')));
        //   }
        //   return callback();
        // };
        let validateNumEmail = (rule, value, callback) => {
            let reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
            if (!reg.test(value) || value === '') {
                return callback(new Error(this.$t('interdisciplinaryManagement.pleaseEnter')))
            }
            return callback()
        }
        let cannotEnter = (rule, value, callback) => {
            let reg = /[`$]/im
            if (reg.test(value)) {
                return callback(new Error(this.$t('identificationToDoList.cannotContain')))
            } else if (value === '') {
                return callback(new Error(this.$t('internship.pleaseEnter')))
            }
            return callback()
        }
        return {
            pickerOptionsStart: {
                disabledDate: time => {
                    let endDateVal = this.queryForm.tutorEndTime
                    if (endDateVal) {
                        // return time.getTime() > endDateVal;
                        return time.getTime() >= new Date(endDateVal).getTime()
                    }
                }
            },
            pickerOptionsEnd: {
                disabledDate: time => {
                    let beginDateVal = this.queryForm.tutorStartTime
                    if (beginDateVal) {
                        // return time.getTime() < beginDateVal;
                        return time.getTime() <= new Date(beginDateVal).getTime() - 86400000
                    }
                }
            },
            pickerStudentStart: {
                disabledDate: time => {
                    let endDateVal = this.queryForm.studentEndTime
                    if (endDateVal) {
                        // return time.getTime() > endDateVal;
                        return time.getTime() >= new Date(endDateVal).getTime()
                    }
                }
            },
            pickerStudentEndTime: {
                disabledDate: time => {
                    let beginDateVal = this.queryForm.studentStartTime
                    if (beginDateVal) {
                        // return time.getTime() < beginDateVal;
                        return time.getTime() <= new Date(beginDateVal).getTime() - 86400000
                    }
                }
            },
            variableList: '',
            queryForm: {
                teacherId: null,
                name: '',
                college: '',
                technical: '',
                teacherPhone: '',
                teacherEmail: '',
                studentList: [
                    {
                        studentId: '',
                        phone: '',
                        email: ''
                    }
                ],
                tutorStartTime: null,
                tutorEndTime: null,
                studentStartTime: null,
                studentEndTime: null,
                student: '',
                paperTitle: '',
                applyDirection: '',
                applyMajor: '',
                country: '',
                applyMoney: '',
                outsideTutorName: '',
                outsideTutorSubject: '',
                outsideTutorDirection: '',
                outsideTutorJob: '',
                outsideTutorPost: '',
                outsideTutorOfficeholding: '',
                outsideTeacherEmail: '',
                positionName: ''
            },
            approver: [],
            options: {
                englisNameSchool: [],
                nameSchool: [],
                approver: [],
                studentList: []
            },
            rulesForm: {
                tutorStartTime: [
                    {
                        required: true,
                        message: this.$t('interdisciplinaryManagement.pleaseChoose'),
                        trigger: 'blur'
                    }
                ],
                tutorEndTime: [
                    {
                        required: true,
                        message: this.$t('interdisciplinaryManagement.pleaseChoose'),
                        trigger: 'blur'
                    }
                ],
                studentStartTime: [
                    {
                        required: true,
                        message: this.$t('interdisciplinaryManagement.pleaseChoose'),
                        trigger: 'blur'
                    }
                ],
                studentEndTime: [
                    {
                        required: true,
                        message: this.$t('interdisciplinaryManagement.pleaseChoose'),
                        trigger: 'blur'
                    }
                ],
                studentId: [
                    {
                        required: true,
                        message: this.$t('interdisciplinaryManagement.pleaseChoose'),
                        trigger: 'blur'
                    }
                ],
                outsideTutorName: [{ required: true, validator: cannotEnter, trigger: 'blur' }],
                outsideTutorSubject: [{ required: true, validator: cannotEnter, trigger: 'blur' }],
                outsideTutorDirection: [
                    { required: true, validator: cannotEnter, trigger: 'blur' }
                ],
                outsideTutorJob: [{ required: true, validator: cannotEnter, trigger: 'blur' }],
                outsideTutorPost: [{ validator: this.validateCannotCon, trigger: 'blur' }],
                applyMoney: [{ required: true, validator: this.validateWeight, trigger: 'blur' }],
                applyMajor: [{ required: true, validator: cannotEnter, trigger: 'blur' }],
                applyDirection: [{ required: true, validator: cannotEnter, trigger: 'blur' }],
                // paperTitle: [
                //   { required: true, message: this.$t('internship.pleaseEnter'), trigger: 'blur' }
                // ],
                country: [
                    { required: true, message: this.$t('internship.pleaseEnter'), trigger: 'blur' }
                ],
                applySchoolId: [
                    { required: true, message: this.$t('internship.pleaseEnter'), trigger: 'blur' }
                ],
                disciplineDomain: [{ required: true, validator: cannotEnter, trigger: 'blur' }],
                outsideTutorOfficeholding: [{ validator: this.validateCannotCon, trigger: 'blur' }],
                studentId: [
                    { required: true, message: this.$t('internship.pleaseEnter'), trigger: 'blur' }
                ],
                teacherId: [
                    {
                        required: true,
                        message: this.$t('internship.pleaseEnter'),
                        trigger: 'change'
                    }
                ],
                paperTitle: [
                    {
                        required: true,
                        message: this.$t('interdisciplinaryManagement.studentPaperMust'),
                        trigger: 'change'
                    }
                ],
                teacherPhone: [{ required: true, validator: validateNum, trigger: 'change' }],
                phoneNumber: [{ required: true, validator: validateNum, trigger: 'change' }],
                outsideTeacherEmail: [
                    { required: true, validator: validateNumEmail, trigger: 'blur' }
                ],
                teacherEmail: [{ required: true, validator: validateNumEmail, trigger: 'change' }],
                email: [{ required: true, validator: validateNumEmail, trigger: 'change' }]
            }
        }
    },
    created() {
        this.compile == '新增'
            ? (this.variableList = this.$t('interdisciplinaryManagement.increased'))
            : this.compile == '编辑'
            ? (this.variableList = this.$t('interdisciplinaryManagement.edit'))
            : (this.variableList = this.$t('interdisciplinaryManagement.examine'))
        let obj = {
            condition: {
                nationId: ''
            },
            pageNum_: 1,
            pageSize_: 99999
        }
        this.postApproveAgree(obj)
    },
    // mounted() {
    //   console.log(this.dataList);

    //   if (this.compile == '新增') {
    //     this.$refs['addform'].resetFields();
    //     this.dataList = {}
    //   } else if (this.compile == '编辑') {

    //     if (this.dataList) {
    //       let list = JSON.parse(JSON.stringify(this.dataList));
    //       console.log(list, 'dsfd');
    //       // this.queryForm.studentList = list.students;
    //       this.queryForm.name = list.teacherInfo.name
    //       this.queryForm.college = list.teacherInfo.facultyI18n
    //       this.queryForm.technical = list.teacherInfo.title
    //       // this.queryForm.paperName = list.students[0].paperName
    //       this.queryForm = list;

    //       // this.changeInput(list.students[0].studentId)
    //        interManagementApi.getStudents(list.students[0].studentId).then(res => {
    //         this.options.studentList = res.data;
    //       })
    //     //   if (list.students[0].studentId) {
    //     //     setTimeout(() => {
    //     //         interManagementApi.getStudents(list.students[0].studentId).then(res => {
    //     //         this.options.studentList = res.data;
    //     //       })
    //     //     }, 200);
    //     // } else {
    //     //     this.options.studentList = [];
    //     // }
    //     // this.queryForm.studentList = []
    //     if (this.options.studentList) {
    //       this.options.studentList.forEach(el => {
    //         if (list.students[0].studentId == el.studentId) {
    //           this.queryForm.studentList.push(el);
    //           this.queryForm.paperName = el.paperName
    //         }
    //       })
    //     }
    //       // this.queryForm.teacherPhone = list.teacherInfo.telephone
    //       // this.queryForm.teacherEmail = list.teacherInfo.email
    //       // this.remoteMethodOne(list.teacherId)
    //       // this.changeClick(list.teacherId)

    //     }
    //   }
    // },
    // watch: {
    //   dataList: {
    //     handler: function(newV, oldV) {
    //       console.log(this.dataList, 'dsfd');
    //       // if (newV) {
    //         if (this.compile === '编辑') {
    //           // if (this.dataListProp) {
    //             let list = JSON.parse(JSON.stringify(this.dataList));
    //             //   let list = JSON.parse(JSON.stringify(this.dataList));
    //           console.log(list, 'dsfd');

    //           this.queryForm = list;
    //           this.queryForm.studentList = list.students;
    //           this.queryForm.name = list.teacherInfo.name
    //           this.queryForm.college = list.teacherInfo.facultyI18n
    //           this.queryForm.technical = list.teacherInfo.title
    //           this.queryForm.paperName = list.students[0].paperName
    //           // this.queryForm.teacherPhone = list.teacherInfo.telephone
    //           // this.queryForm.teacherEmail = list.teacherInfo.email
    //           // this.remoteMethodOne(list.teacherId)
    //           // this.changeClick(list.teacherId)

    //           //   if (this.queryForm.condition.fromSys === 0) {
    //           //     this.queryForm.condition.name = list.name + '(' + list.account + ')';
    //           //   }
    //           // }
    //         } else if (this.compile === '新增') {
    //           this.dataList = {};
    //           this.$refs['addform'].resetFields();
    //           for (const key in this.queryForm) {
    //             if (key == 'studentList') {
    //               this.queryForm.studentList = []
    //             } else {
    //               this.queryForm[key] = "";
    //             }
    //           }
    //           // this.$refs['addform'].clearValidate();
    //         }
    //       // }
    //     },
    //     deep: true
    //   }
    // },
    methods: {
        cancelOperate() {
            this.$refs['addform'].resetFields()
        },
        validateWeight(rule, value, callback) {
            if (value > 0) {
                let expReg = /^([0-9]{1,7})(\.\d{1,2})?$/
                // let expReg = /^([1-9]|[1-9]\d{1,6})(\.\d{1,3})?$/;
                if (!value) {
                    callback(new Error(this.$t('internship.pleaseEnter')))
                } else if (!expReg.test(value)) {
                    callback(new Error(this.$t('interdisciplinaryManagement.pleaseNumber')))
                } else {
                    callback()
                }
            } else {
                callback(new Error(this.$t('interdisciplinaryManagement.pleaseNumber')))
            }
        },
        validateCannotCon(rule, value, callback) {
            let regEn = /[`$]/im
            if (regEn.test(value)) {
                return callback(new Error(this.$t('identificationToDoList.cannotContain')))
            } else if (value === '') {
                return callback()
            } else {
                return callback()
            }
        },
        postApproveAgree(date) {
            interAcaConferenceApi.overseasCollege(date).then(res => {
                if (res.data.list.length > 0) {
                    res.data.list.forEach(el => {
                        this.options.nameSchool.push({
                            value: el.id,
                            label: el.collegeName,
                            nationName: el.nationName
                        })
                        this.options.englisNameSchool.push({
                            value: el.id,
                            label: el.collegeNameEn,
                            nationName: el.nationName
                        })
                    })
                }
            })
        },
        changeEnglisNameSchool(val) {
            this.options.englisNameSchool.forEach(el => {
                if (val == el.value) {
                    this.queryForm.country = el.nationName
                }
            })
        },
        reback() {
            this.$emit('change-exam')
        },
        querySearch(queryString, cb) {
            var restaurants = this.options.studentList
            var results = queryString
                ? restaurants.filter(this.createFilter(queryString))
                : restaurants
            // 调用 callback 返回建议列表的数据
            cb(results)
        },
        createFilter(queryString) {
            return restaurant => {
                return restaurant.studentId.toLowerCase().indexOf(queryString.toLowerCase()) === 0
            }
        },
        changeClick(val) {
            if (val) {
                findTeacherInfoList({
                    condition: val,
                    pageSize_: 100,
                    pageNum_: 0
                }).then(res => {
                    if (res && res.code == 200) {
                        // res.data.list.forEach(row => {
                        //     row.name += '(' + row.code + ')';
                        // })
                        this.options.approver = res.data.list
                    }
                })
                this.options.approver.forEach(el => {
                    if (el.code == val) {
                        this.queryForm.name = el.name
                        this.queryForm.college = el.facultyI18n
                        this.queryForm.technical = el.title
                        this.queryForm.teacherPhone = el.phone
                        this.queryForm.teacherEmail = el.email
                    }
                })
            } else {
                this.options.approver = []
            }
            // name
        },
        // 工号改变获取数据
        remoteMethodOne(query) {
            if (!!query) {
                // setTimeout(() => {
                findTeacherInfoList({
                    condition: query,
                    pageSize_: 100,
                    pageNum_: 0
                }).then(res => {
                    if (res && res.code == 200) {
                        // res.data.list.forEach(row => {
                        //     row.name += '(' + row.code + ')';
                        // })
                        this.options.approver = res.data.list
                    }
                })
                // }, 200);
            } else {
                this.options.approver = []
            }
        },
        // 学号改变获取数据
        remoteMethodTow(query) {
            if (!!query) {
                setTimeout(() => {
                    interManagementApi.getStudents(query).then(res => {
                        this.options.studentList = res.data
                    })
                }, 200)
            } else {
                this.options.studentList = []
            }
        },
        // 学号改变获取数据
        changeInput(val) {
            if (val) {
                // setTimeout(() => {
                    interManagementApi.getStudents(val).then(res => {
                        this.options.studentList = res.data
                    })
                // }, 200)
            } else {
                this.options.studentList = []
            }
            this.queryForm.studentList = []
            if (this.options.studentList) {
                this.options.studentList.forEach(el => {
                    if (val == el.studentId) {
                        this.queryForm.studentList.push(el)
                        this.queryForm.paperTitle = el.paperName
                    }
                })
            }
            this.queryForm.studentList.splice(1, 1)
            // this.queryForm.studentList.slice(0, 1)
            // console.log(this.queryForm.studentList, '1588sd');
        },
        cancelClose() {
            this.$refs['addform'].resetFields()
            for (const key in this.queryForm) {
                if (key == 'studentList') {
                    this.queryForm.studentList = []
                } else {
                    this.queryForm[key] = ''
                }
            }
        },
        // 保存
        conserve() {
            this.$refs['addform'].validate(valid => {
                if (valid) {
                    // if (this.dataProp === '新增') {

                    if (this.compile == '新增') {
                        // let studentList = JSON.parse(JSON.stringify(this.queryForm.studentList))
                        // let list = []
                        // studentList.forEach(el => {
                        //   list.push({
                        //     "studentId": el.studentId,
                        //     "phone": el.phoneNumber,
                        //     "email": el.email
                        //   })
                        // })
                        // this.queryForm.studentList = list
                        // interManagementApi.interdisciplineAdd(this.queryForm).then(res => {
                        //   this.$message.success(this.$t('internship.successfully'));
                        //   this.$refs['addform'].resetFields();
                        //   for (const key in this.queryForm) {
                        //     if (key == 'studentList') {
                        //       this.queryForm.studentList = []
                        //     } else {
                        //       this.queryForm[key] = "";
                        //     }
                        //   }
                        //   this.reback();
                        // })
                        this.$emit('change-add', this.queryForm)
                    } else if (this.compile == '编辑') {
                        interManagementApi.interdisciplineEdit(this.queryForm).then(res => {
                            this.$message.success(this.$t('internship.successfully'))
                            this.reback()
                        })
                    }
                    // }

                    // console.log(this.queryForm, 'dgdfg');
                }
            })
        }
    }
}
</script>